package com.gao.api.gate.quick.proto.server;

import com.gao.api.gate.quick.proto.http.ClientRequestReceiver;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.http.HttpContentCompressor;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * <p></p>
 *
 * @author gaoshuangwen
 * @since 2022/01/07 22:15
 */
public class HttpServerChannelInitializer extends ChannelInitializer<Channel> {
    @Override
    protected void initChannel(Channel ch) throws Exception {
        ch.pipeline()
                .addLast("codec", new HttpServerCodec())// HTTP 编解码
                .addLast("compressor", new HttpContentCompressor())// HttpContent 压缩
                //.addLast("aggregator", new HttpObjectAggregator(65536))// HTTP 消息聚合
                .addLast("handler", new ClientRequestReceiver());
    }
}
